package cn.fighter3.service.relationship;

import cn.fighter3.entity.relationship.Authorof2;
import org.springframework.data.neo4j.annotation.Query;
import org.springframework.data.neo4j.repository.Neo4jRepository;

public interface Authorof2Dao extends Neo4jRepository<Authorof2,Long> {

//    @Query("match (n:Fgbook),(m:People) where n.bookId=$fromId and m.authorId=$toId create (n)-[r:Authorof]->(m) return m")
//    People addAuthor(String fromId, String toId);

    //Authorof2 addAuthor(Fgbook from,People to);
//删除关系
//    @Query("MATCH (fromNode) WHERE id(fromNode) = {fromId} MATCH (toNode) WHERE id(toNode) = {toId} MATCH (fromNode)-[r]->(toNode) DELETE r")
//
//    void deleteByNodeId(@Param(value = "fromId") long fromId,@Param(value = "toId") long toId);
    @Query("match (n:Fgbook),(m:People) where n.bookId=$fromId and m.authorId=$toId match (n)-[r:Authorof]->(m) delete r")
    void deleteByNodeId(String fromId,String toId);
}
